// JavaScript Document
$(function(){


	
});

function callInterface(userid){
	if(typeof(JSCallBackInterface)!="undefined"){
		JSCallBackInterface.callback(userid);
	}
	
    
}


function loginByPwd(){

	$.ajax({
		url: "http://"+remote_ip+":"+remote_port+"/"+remote_name+"/app/screen/show/login", //路径 
		dataType: "json",	
		type: 'POST',
		data:{
			"loginName":$("#loginmodel-username").val(),
			"password":$("#loginmodel-password").val(),
		},
		success: function(result) { //返回数据根据结果进行相应的处理  
			if(result.id!=""){
				//存储本地缓存用户信息
				var user=new Object();
				user.id=result.id;
				user.name=result.name;
				user.officeId=result.office.id;
				user.photo=result.photo;
				localStorage.removeItem("user"); 
				localStorage.setItem("user", JSON.stringify(user)); 			
				setTimeout(function() {
					window.location.href="index.html";
				}, 100);
			}
			
			
		},
		error: function(XMLHttpRequest, textStatus, errorThrown) {
			$.msg("用户名或密码错误!");
		}
	});	
}

//动态、普通登录切换
function setTab(name,cursel,n){
	for(i=1;i<=n;i++){
		var menu=document.getElementById(name+i);
		var con=document.getElementById("con_"+name+"_"+i);
		con.style.display=i==cursel?"block":"none";
		menu.className=i==cursel?"active":"";
	}
}